<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>加载进度条</title>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        body{
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: #000;
        }
        #progress-container {
            width: 10%;
            /* background-color: #f3f3f3; */
            /* border: 1px solid #ccc; */
            position: relative;
            text-align: center;
            color: white;
        }
        #progress-bar {
            width: 0;
            height: 2px;
            background-color: #f30101;
            text-align: center;
            /* color: white; */
            line-height: 30px;
        }
    </style>
</head>
<body>
    <div id="progress-container">
        <h1 style="color: #f30101;">loading</h1>
        <p id="progress-text">0%</p>
        <div id="progress-bar"></div>
    </div>
    <button id="start">开始加载</button>

    <script>
        $(document).ready(function() {
            $('#start').click(function() {
                let progress = 0;
                let interval = setInterval(function() {
                    if (progress >= 100) {
                        clearInterval(interval);
                    } else {
                        progress += 1;
                        $('#progress-bar').css('width', progress + '%');
                        $('#progress-text').text(progress + '%');
                    }
                }, 60);
            });
        });
    </script>
</body>
</html>